<template>
  <div class="favicon-test">
    <h1>网页图标（Favicon）更改测试</h1>
    
    <div class="test-sections">
      <!-- 当前图标展示 -->
      <div class="test-section">
        <h2>当前网页图标</h2>
        <div class="icon-display">
          <div class="icon-item">
            <img src="/complete.png" alt="当前网页图标" class="favicon-preview" />
            <p>Complete 图标</p>
            <p class="file-path">文件路径: /public/complete.png</p>
          </div>
        </div>
      </div>
      
      <!-- 配置信息 -->
      <div class="test-section">
        <h2>配置信息</h2>
        <div class="config-info">
          <div class="config-item">
            <h3>HTML 配置</h3>
            <div class="code-block">
              <code>&lt;link rel="icon" type="image/png" href="/complete.png" /&gt;</code>
            </div>
            <p>位置: <code>index.html</code> 第6行</p>
          </div>
          
          <div class="config-item">
            <h3>文件位置</h3>
            <ul>
              <li><strong>源文件:</strong> <code>src/assets/complete.png</code></li>
              <li><strong>网页图标:</strong> <code>public/complete.png</code></li>
              <li><strong>原始图标:</strong> <code>public/favicon.ico</code> (已保留)</li>
            </ul>
          </div>
        </div>
      </div>
      
      <!-- 验证步骤 -->
      <div class="test-section">
        <h2>验证步骤</h2>
        <div class="verification-steps">
          <div class="step">
            <div class="step-number">1</div>
            <div class="step-content">
              <h4>查看浏览器标签页</h4>
              <p>检查浏览器标签页左侧是否显示 complete 图标</p>
            </div>
          </div>
          
          <div class="step">
            <div class="step-number">2</div>
            <div class="step-content">
              <h4>刷新页面</h4>
              <p>按 F5 或 Ctrl+R 刷新页面，确保图标正确加载</p>
            </div>
          </div>
          
          <div class="step">
            <div class="step-number">3</div>
            <div class="step-content">
              <h4>清除缓存</h4>
              <p>如果图标未更新，按 Ctrl+Shift+R 强制刷新清除缓存</p>
            </div>
          </div>
          
          <div class="step">
            <div class="step-number">4</div>
            <div class="step-content">
              <h4>检查书签</h4>
              <p>将页面添加到书签，查看书签图标是否正确</p>
            </div>
          </div>
        </div>
      </div>
      
      <!-- 技术说明 -->
      <div class="test-section">
        <h2>技术说明</h2>
        <div class="tech-info">
          <h3>更改内容</h3>
          <ul>
            <li>将 <code>src/assets/complete.png</code> 复制到 <code>public/complete.png</code></li>
            <li>修改 <code>index.html</code> 中的 favicon 链接</li>
            <li>从 <code>image/svg+xml</code> 改为 <code>image/png</code> 格式</li>
            <li>从 <code>/favicon.ico</code> 改为 <code>/complete.png</code></li>
          </ul>
          
          <h3>浏览器兼容性</h3>
          <ul>
            <li>✅ Chrome: 支持 PNG 格式 favicon</li>
            <li>✅ Firefox: 支持 PNG 格式 favicon</li>
            <li>✅ Safari: 支持 PNG 格式 favicon</li>
            <li>✅ Edge: 支持 PNG 格式 favicon</li>
          </ul>
          
          <h3>注意事项</h3>
          <ul>
            <li>浏览器可能会缓存 favicon，需要强制刷新</li>
            <li>建议图标尺寸为 16x16、32x32 或 48x48 像素</li>
            <li>PNG 格式比 ICO 格式更现代，支持透明背景</li>
            <li>原始的 favicon.ico 文件已保留作为备份</li>
          </ul>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
// Favicon 测试页面
</script>

<style scoped>
.favicon-test {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.test-sections {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.test-section {
  padding: 20px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #f9f9f9;
}

.test-section h2 {
  margin-bottom: 20px;
  color: #333;
  border-bottom: 2px solid #409EFF;
  padding-bottom: 10px;
}

.icon-display {
  display: flex;
  justify-content: center;
  padding: 20px;
}

.icon-item {
  text-align: center;
  padding: 20px;
  background: white;
  border-radius: 8px;
  border: 1px solid #eee;
}

.favicon-preview {
  width: 64px;
  height: 64px;
  object-fit: contain;
  margin-bottom: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.file-path {
  font-family: monospace;
  color: #666;
  font-size: 12px;
}

.config-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
}

.config-item {
  background: white;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #eee;
}

.config-item h3 {
  color: #409EFF;
  margin-bottom: 15px;
}

.code-block {
  background: #f5f5f5;
  padding: 15px;
  border-radius: 4px;
  margin: 10px 0;
  overflow-x: auto;
}

.code-block code {
  font-family: monospace;
  color: #e74c3c;
}

.config-item ul {
  margin: 10px 0;
  padding-left: 20px;
}

.config-item li {
  margin: 8px 0;
  line-height: 1.6;
}

.config-item code {
  background: #f5f5f5;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  color: #e74c3c;
}

.verification-steps {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  background: white;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #eee;
}

.step-number {
  width: 40px;
  height: 40px;
  background: #409EFF;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  flex-shrink: 0;
}

.step-content h4 {
  margin-bottom: 8px;
  color: #333;
}

.step-content p {
  color: #666;
  line-height: 1.6;
}

.tech-info {
  background: white;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #eee;
}

.tech-info h3 {
  color: #409EFF;
  margin: 20px 0 10px 0;
}

.tech-info h3:first-child {
  margin-top: 0;
}

.tech-info ul {
  margin: 10px 0;
  padding-left: 20px;
}

.tech-info li {
  margin: 8px 0;
  line-height: 1.6;
}

.tech-info code {
  background: #f5f5f5;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  color: #e74c3c;
}
</style>
